package com.gitee.qdbp.jdbc.operator.update;

import com.gitee.qdbp.jdbc.api.SqlBoot;
import com.gitee.qdbp.jdbc.operator.DbBinaryOperator;
import com.gitee.qdbp.jdbc.operator.base.DbAbstractOperator;
import com.gitee.qdbp.jdbc.sql.SqlBuffer;

/**
 * 二元Add运算符(UPDATE SET columnName=columnName+number)
 *
 * @author zhaohuihua
 * @version 20200123
 */
public class DbBinaryAddOperator extends DbAbstractOperator implements DbBinaryOperator {

    /** 版本序列号 **/
    private static final long serialVersionUID = 1L;

    public DbBinaryAddOperator() {
        super("Add");
    }

    @Override
    public SqlBuffer buildSql(String columnName, Object columnValue, SqlBoot sqlBoot) {
        return sqlBoot.newSqlBuilder().ad(columnName).ad('=').ad(columnName).ad('+').var(columnValue).out();
    }

}
